package com.project.weimi.fragment;

import java.util.ArrayList;
import java.util.List;

import com.project.weimi.R;
import com.project.weimi.activity.OrderDetailsActivity;
import com.project.weimi.adapter.AllOrder_Adapter;
import com.project.weimi.adapter.InboundFragment_Adapter;
import com.project.weimi.entity.response.OrderEntity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

/**
 * 待收货
 * 
 * @author WUSC
 *
 */
public class Inbound_Fragment extends BaseFragment {
	private View view;
	private ListView inbound_lv;
	private List<OrderEntity> list;
	private InboundFragment_Adapter adapter;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		view = inflater.inflate(R.layout.activity_inbound, null);
		initView();
		return view;
	}

	private void initView() {
		// TODO Auto-generated method stub
		inbound_lv = (ListView) view.findViewById(R.id.inbound_listview);

		list = new ArrayList<OrderEntity>();
		for (int i = 0; i < 10; i++) {
			list.add(new OrderEntity("宝贝已发货", 59.81, "薄款牛仔裤男直筒宽松5分裤子男" + "\n" + "士牛仔短裤男夏季五分裤休闲中", "颜色:206款码;尺码:33[二尺六]",
					1, 199.0, 59.81, "确认收货", R.drawable.a));
		}

		adapter = new InboundFragment_Adapter(getActivity(), list);
		inbound_lv.setAdapter(adapter);
		inbound_lv.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				// Intent intent = new Intent(getActivity(),
				// OrderDetailsActivity.class);
				// getActivity().startActivity(intent);
				Toast.makeText(getActivity(), "你点击了此项", 1).show();
			}
		});
	}
}
